<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数组的差异</title>
</head>
<body>
    <script>
        let a = [
            {
                id: 1,
                name: 'haha'
            },
            {
                id: 2,
                name: 'haha'
            }
        ];

        let b = [
            {
                id: 1,
                name: 'haha'
            },
            {
                id: 2,
                name: 'haha'
            },
            {
                id: 3,
                name: 'haha'
            },
            {
                id: 4,
                name: 'haha'
            }
        ];
        let idAry = a.map(item => item.id);
        let c = b.filter(item1 => {
            return idAry.indexOf(item1.id) < 0
        });
        console.log(c);

        let a1 = [1,2,3,4,5];
        let b1 = [3,4,5,6,7];

        // function AryDiff (a1, a2) {
        //     let temp = [];
        //     if () {

        //     }
        //     a1.filter(item1 => {
        //         for () {

        //         }
        //     })
        // }

        AryDiff(a1,b1);
    </script>
</body>
</html>